.386
.model flat, C
.stack 4096


.data
    buf db 1023 dup("abcdefg"), 0
    msg db "%08x: ", 16 dup(0), 13, 10, 0
.code
extern putchar:near
extern printf:near
extern puts:near

print macro
    push esi
    push offset msg
    call printf
    add esp, 8
endm

main proc
    ; push offset buf
    ; call puts
    mov esi, offset buf
    

copy:
    mov edi, offset msg
    add edi, 6
    mov ecx, 16
lop:
    mov al, [esi]
    mov [edi], al
    inc esi
    inc edi
    cmp al, 0
    je done
    loop lop

    print
    jmp copy

done:
    print
main endp
end main